package com.sh.data.engine.domain.authority.model.param;

import com.sh.data.engine.domain.authority.model.domain.RoleDomain;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Objects;

/**
 * @author tinglan.ys @Title: @Package: @Description:
 * @date 2022/1/5 下午3:56
 */
@Data
public class RoleParam implements Comparable {
    private Long id;

    /**
     * 角色名称
     */
    private String roleName;

    /**
     * 角色描述
     */
    private String roleDesc;

    /**
     * 空间Id
     */
    private Long projectId;

    /**
     * 菜单列表
     */
    private List<RoleDomain.SimpleMenuEntity> menuList;

    @Override
    public int compareTo(@NotNull Object o) {
        RoleParam param = (RoleParam) o;

        if (Objects.equals(param.getId(), this.id)
            && Objects.equals(param.getRoleName(), this.roleName)
            && Objects.equals(param.getRoleDesc(), this.roleDesc)
            && Objects.equals(param.getMenuList().toString(), this.menuList.toString())) {
            return 0;
        }

        return 1;
    }
}
